<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Build from Markup</title>

<%= javascript_include_tag :defaults %>
<%= javascript_include_tag "yui/build/yahoo-dom-event/yahoo-dom-event.js" %>
<%= javascript_include_tag "yui/build/element/element-beta.js" %>
<%= javascript_include_tag "yui/build/tabview/tabview.js" %>

<%= stylesheet_link_tag "/javascripts/yui/build/fonts/fonts-min.css" %>
<%= stylesheet_link_tag "/javascripts/yui/build/tabview/assets/skins/sam/tabview.css" %>

<%= javascript_tag(content=
	"function addText(request) {
	    if(request.responseText!='0x332')
	    document.getElementById(\"tab1\").innerHTML += (request.responseText);
	    hold(false)
		}
		
	function hold(value) {
	    document.getElementById(\"hidden\").innerHTML=value
		}"
		
	)
%>

<style type="text/css">
/*margin and padding on body element
  can introduce errors in determining
  element position and are not recommended;
  we turn them off as a foundation for YUI
  CSS treatments. */
body {
	margin:0;
	padding:0;
}
</style>

<!--there is no custom header content for this example-->

</head>

<h1>Signed in as <%= @jid.to_s() %></h1>
<br/>

<%= periodically_call_remote :update => '',
    :condition => "document.getElementById(\"hidden\").innerHTML=='false'",
    :url => {:action => "msg_handler"},
    :frequency => 2.0,
    :after => "hold(true)",
    :complete =>"addText(request)" %>
 
<b>Message Board:</b>

<body class=" yui-skin-sam">


<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->

<div id="mdisp" class="yui-navset">
    <ul class="yui-nav">
        <li class="selected"><a href="#tab1"><em>Tab One Label</em></a></li>
        <li ><a href="#tab2"><em>Tab Two Label</em></a></li>
        <li><a href="#tab3"><em>Tab Three Label</em></a></li>
    </ul>            
    <div class="yui-content">
        <div id="tab1"></div>
        <div id="tab2"><p>No new messages !!</p></div>
        <div id="tab3"><p>No new messages !!</p></div>
    </div>
</div>
<script>
(function() {
    var tabView = new YAHOO.widget.TabView('mdisp');
})();
</script>
<br />
<%= form_remote_tag :update => '', 
  :url => { :action => 'send_msg' } %>
<%= text_field_tag :newmessage %>
<input type="submit" value="Send"/>
<%= end_form_tag %>


<div id="hidden">false</div>

	
</body>
</html>
